//
//  CinemaCell.m
//  UI_豆瓣
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "CinemaCell.h"

@implementation CinemaCell


- (void)dealloc
{
    [_trafficRoutes release];
    [_phoneNumber release];
    [_backgroundImageView release];
    [_nameLabel release];
    [_address release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

-(void)createCell
{
    //背景
    self.backgroundImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, 355, 120)];
    self.backgroundImageView.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self addSubview:self.backgroundImageView];
    [_backgroundImageView release];
    
    
    //影院名字
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 345, 30)];
    [self.backgroundImageView addSubview:self.nameLabel];
    self.nameLabel.font = [UIFont boldSystemFontOfSize:20];
    [_nameLabel release];
    
    
    //影院地址
    self.address = [[UILabel alloc]initWithFrame:CGRectMake(5, 40, 345, 20)];
    [self.backgroundImageView addSubview:self.address];
    self.address.numberOfLines = 0;
    [_address release];
    
    
    //电话
    self.phoneNumber = [[UILabel alloc]initWithFrame:CGRectMake(5, 10, 345, 20)];
    [self.backgroundImageView addSubview:self.phoneNumber];
    [_phoneNumber release];

    
}


-(void)setMycinema:(Cinema *)mycinema
{
    if (_mycinema != mycinema) {
        [_mycinema release];
        _mycinema = [mycinema retain];
    }
    self.nameLabel.text = self.mycinema.cinemaName;
    self.address.text = self.mycinema.address;
    self.phoneNumber.text = self.mycinema.telephone;
    [self.address sizeToFit];
    self.phoneNumber.frame = CGRectMake(5, self.address.frame.origin.y+self.address.frame.size.height + 5, 345, 20);
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
